import Vue from 'vue';
import VueRouter from 'vue-router';
import layout from '@/layout/index.vue';
import login from '@/views/login/index.vue';
import inexistence from '@/views/404/index.vue';

Vue.use(VueRouter);

const routes = [
  {
    path: '/login',
    name: 'login',
    component: login,
  },
  {
    path: '/404',
    name: 'inexistence',
    component: inexistence,
  },
  {
    path: '/',
    component: layout,
    redirect: '/home',
    children: [
      {
        // 首页
        path: '/home',
        name: 'home',
        component: () => import('@/views/homePage/index.vue'),
      },
      {
        // 用户档案
        path: '/user',
        name: 'user',
        component: () => import('@/views/userFile/index.vue'),
      },
      {
        // 用户往返记录
        path: '/userGoto',
        name: 'userGoto',
        component: () => import('@/views/userGotoreturn/index.vue'),
      },
      {
        // 应急事件管理
        path: '/emergency',
        name: 'emergency',
        component: () => import('@/views/emergency/index.vue'),
      },
      {
        // 场所码管理
        path: '/siteCode',
        name: 'siteCode',
        component: () => import('@/views/siteCode/index.vue'),
      },
      {
        // 涉疫人员清单
        path: '/epidemicRelated',
        name: 'epidemicRelated',
        component: () => import('@/views/epidemicRelated/index.vue'),
      },
      {
        // 低中高风险地区管理
        path: '/riskArea',
        name: 'riskArea',
        component: () => import('@/views/riskArea/index.vue'),
      },
      {
        // 涉疫交通信息管理
        path: '/epidemicTraffic',
        name: 'epidemicTraffic',
        component: () => import('@/views/epidemicTraffic/index.vue'),
      },
      {
        // 公告管理
        path: '/Proclamation',
        name: 'Proclamation',
        component: () => import('@/views/Proclamation/index.vue'),
      },
      {
        // 审核往返信息填报
        path: 'auditInformation',
        name: 'auditInformation',
        component: () => import('@/views/userGotoreturn/components/auditInformation.vue'),
      },
    ],
  },
  {
    path: '*',
    redirect: '/404',
  },
];

const router = new VueRouter({
  routes,
});

export default router;
